package xio.ccf_201612;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 201612-1 中间数 100
 * Created by Xio on 2017/9/17.
 */
public class MiddleNumber {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
       int count = scanner.nextInt();
       int[] array = new int[count];
        for (int i = 0; i < count; i++) {
            array[i] = scanner.nextInt();
        }
        Arrays.sort(array);
        int indexMid = count/2;
         int mid = array[indexMid];
         int leftCount = count/2;
         int rightCount = count - count/2 -1;
        for (int i = indexMid-1; i >= 0; i--) {
            if (array[i] == mid){
                leftCount --;
            }else {
                break;
            }
        }
        for (int i = indexMid+1; i < count; i++) {
            if (array[i] == mid){
                rightCount --;
            }else {
                break;
            }
        }
        System.out.print(leftCount == rightCount ? mid:-1);
        scanner.close();
    }
}
